Attribute VB_Name = "mTranslate"
'-----------------------------------------------------------------
'             PT DC Hub @ Direct Connect P2P Network
'-----------------------------------------------------------------
'       Developer: Carlos.DF (fLaSh) - Portugal
'          E-mail: carlosferreiracarlos@hotmail.com
' Project started: 10 - September - 2006
'         License: GNU General Public License.
'-----------------------------------------------------------------
'       Thanks to developers and contributores of SDCH/DDCH
'         The Left Hand, ButterflySoul, HaArD and Selyb
'  TheNOP, RollTheDice, JDommi, GhOstFaCE, ArchaicLight and TUFF
'-----------------------------------------------------------------
Option Explicit
  
'INTERFACE LANGUAGE
Public Sub TranslateCtrlCaption(ByVal ctrlName As String, ByVal ctrlCaption As String)
1:    On Error Resume Next
2:    Dim i
3:    Dim strName As String
4:    Dim intIndex As Integer
5:    strName = g_objFunctions.BeforeFirst(ctrlName, "(")
6:    intIndex = g_objFunctions.BeforeLast(g_objFunctions.AfterFirst(ctrlName, "("), ")")
7:    For Each i In frmHub.Controls
8:         If i.Name = strName Then
9:              If i.Index = intIndex Then
10:                i.Caption = ctrlCaption
11:                Exit Sub
12:             End If
13:        End If
14:   Next
End Sub

Public Sub TranslateTabSCaption(ByVal ctrlName As String, ByVal ctrlCaption As String)
1:   On Error Resume Next

3:   Dim i As Integer
4:   Dim X As String

6:   With frmHub
7:      For i = 1 To .tbsMenu.Tabs.count
8:          X = "tbsMenu.Tabs(" & i & ")"
9:         If ctrlName = X Then _
         .tbsMenu.Tabs(i).Caption = ctrlCaption: Exit Sub
11:     Next i
12:     For i = 1 To .tbsSecurity.Tabs.count
13:         X = "tbsSecurity.Tabs(" & i & ")"
14:        If ctrlName = X Then _
         .tbsSecurity.Tabs(i).Caption = ctrlCaption: Exit Sub
16:     Next i
17:     For i = 1 To .tbsInteractions.Tabs.count
18:         X = "tbsInteractions.Tabs(" & i & ")"
19:        If ctrlName = X Then _
                .tbsInteractions.Tabs(i).Caption = ctrlCaption: Exit Sub
21:     Next i
22:     For i = 1 To .tabAdv.Tabs.count
23:         X = "tabAdv.Tabs(" & i & ")"
24:        If ctrlName = X Then _
                .tabAdv.Tabs(i).Caption = ctrlCaption: Exit Sub
26:     Next i
27:     For i = 1 To .tbsHelp.Tabs.count
28:         X = "tbsHelp.Tabs(" & i & ")"
29:        If ctrlName = X Then _
                .tbsHelp.Tabs(i).Caption = ctrlCaption: Exit Sub
31:     Next i
32:     For i = 1 To .tbsStatus.Tabs.count
33:         X = "tbsStatus.Tabs(" & i & ")"
34:        If ctrlName = X Then _
                .tbsStatus.Tabs(i).Caption = ctrlCaption: Exit Sub
36:     Next i
37:     For i = 1 To .tbsDbManager.Tabs.count
38:         X = "tbsDbManager.Tabs(" & i & ")"
39:        If ctrlName = X Then _
                .tbsDbManager.Tabs(i).Caption = ctrlCaption: Exit Sub
41:     Next i
42:     For i = 1 To .tabBansIPs.Tabs.count
43:         X = "tabBansIPs.Tabs(" & i & ")"
44:        If ctrlName = X Then _
                .tabBansIPs.Tabs(i).Caption = ctrlCaption: Exit Sub
46:     Next i
47:     For i = 1 To .tabStatus.Tabs.count
48:         X = "tabStatus.Tabs(" & i & ")"
49:        If ctrlName = X Then _
                .tabStatus.Tabs(i).Caption = ctrlCaption: Exit Sub
51:     Next i
52:  End With
End Sub

Public Sub TranslateListViewCaption(ByVal ctrlName As String, ByVal ctrlText As String)
1:   On Error Resume Next

3:   Dim i As Integer
4:   Dim X As String

6:   With frmHub
7:      For i = 1 To .lvwCommands.ColumnHeaders.count
8:          X = "lvwCommands.ColumnHeaders(" & i & ")"
9:         If ctrlName = X Then _
                .lvwCommands.ColumnHeaders(i).Text = ctrlText: Exit Sub
11:     Next i
12:     For i = 1 To .lvwUsers.ColumnHeaders.count
13:         X = "lvwUsers.ColumnHeaders(" & i & ")"
14:        If ctrlName = X Then _
                .lvwUsers.ColumnHeaders(i).Text = ctrlText: Exit Sub
16:     Next i
17:     For i = 1 To .lvwHubList.ColumnHeaders.count
18:         X = "lvwHubList.ColumnHeaders(" & i & ")"
19:        If ctrlName = X Then _
                .lvwHubList.ColumnHeaders(i).Text = ctrlText: Exit Sub
21:     Next i
22:     For i = 1 To .lvwScripts.ColumnHeaders.count
23:         X = "lvwScripts.ColumnHeaders(" & i & ")"
24:        If ctrlName = X Then _
                .lvwScripts.ColumnHeaders(i).Text = ctrlText: Exit Sub
26:     Next i
27:     For i = 1 To .lvwRegistered.ColumnHeaders.count
28:         X = "lvwRegistered.ColumnHeaders(" & i & ")"
29:        If ctrlName = X Then _
                .lvwRegistered.ColumnHeaders(i).Text = ctrlText: Exit Sub
31:     Next i
32:     For i = 1 To .lvwBans.ColumnHeaders.count
33:         X = "lvwBans.ColumnHeaders(" & i & ")"
34:        If ctrlName = X Then _
                .lvwBans.ColumnHeaders(i).Text = ctrlText: Exit Sub
36:     Next i
37:     For i = 1 To .lvwPlugins.ColumnHeaders.count
38:         X = "lvwPlugins.ColumnHeaders(" & i & ")"
39:        If ctrlName = X Then _
                .lvwPlugins.ColumnHeaders(i).Text = ctrlText: Exit Sub
41:     Next i
42:     For i = 1 To .lvwChatRom.ColumnHeaders.count
43:         X = "lvwChatRom.ColumnHeaders(" & i & ")"
44:        If ctrlName = X Then _
                .lvwChatRom.ColumnHeaders(i).Text = ctrlText: Exit Sub
46:     Next i
47:     For i = 1 To .lvwPlan.ColumnHeaders.count
48:         X = "lvwPlan.ColumnHeaders(" & i & ")"
49:        If ctrlName = X Then _
                .lvwPlan.ColumnHeaders(i).Text = ctrlText: Exit Sub
51:     Next i
52:     For i = 1 To .lvwPlan.ColumnHeaders.count
53:         X = "lvwTempIPBan.ColumnHeaders(" & i & ")"
54:        If ctrlName = X Then _
                .lvwTempIPBan.ColumnHeaders(i).Text = ctrlText: Exit Sub
56:     Next i
57:     For i = 1 To .lvwPlan.ColumnHeaders.count
58:         X = "lvwPermIPBan.ColumnHeaders(" & i & ")"
59:        If ctrlName = X Then _
                .lvwPermIPBan.ColumnHeaders(i).Text = ctrlText: Exit Sub
61:     Next i
62:     For i = 1 To .lvwRangeIPBan.ColumnHeaders.count
63:         X = "lvwRangeIPBan.ColumnHeaders(" & i & ")"
64:        If ctrlName = X Then _
                .lvwRangeIPBan.ColumnHeaders(i).Text = ctrlText: Exit Sub
66:     Next i
67:     For i = 1 To .lvwLanguages.ColumnHeaders.count
68:         X = "lvwLanguages.ColumnHeaders(" & i & ")"
69:        If ctrlName = X Then _
                .lvwLanguages.ColumnHeaders(i).Text = ctrlText: Exit Sub
71:     Next i
72:  End With
End Sub

Public Sub TranslateTexts(ByVal ctrlName As String, ByVal ctrlText As String)
1: On Error Resume Next
2:    Dim i
3:    Dim strName As String
4:    Dim intIndex As Integer
5:    strName = g_objFunctions.BeforeFirst(ctrlName, "( ")
6:    intIndex = g_objFunctions.BeforeLast(g_objFunctions.AfterFirst(ctrlName, "("), ")")
7:    For Each i In frmHub.Controls
8:        If i.Name = strName Then
9:            If i.Index = intIndex Then
10:                i.Text = ctrlText
11:                Exit Sub
12:            End If
13:        End If
14:    Next
End Sub

Public Sub TranslateToolBar(ByVal ctrlName As String, ByVal ctrlToolTip As String)
1: On Error Resume Next
2:    Dim i As Integer
3:    Dim X As String
4:    With frmHub
5:        For i = 1 To .tlbScript.Buttons.count
6:            X = "tlbScript.Buttons.Item(" & i & ")"
7:            If ctrlName = X Then _
                .tlbScript.Buttons.Item(i).ToolTipText = ctrlToolTip: Exit Sub
9:        Next i
10:       For i = 1 To .tlbScript.Buttons.count
11:           X = "tlbScriptPriority.Buttons.Item(" & i & ")"
12:           If ctrlName = X Then _
                .tlbScriptPriority.Buttons.Item(i).ToolTipText = ctrlToolTip: Exit Sub
14:       Next i
15:   End With
End Sub

Public Sub ClearTranslations()
1:    Dim CTL As Control
2:    Dim i As Integer

4:    On Error GoTo Err
 
     'Clear all captions and all tooltips..
     'This is ideal to verify mistakes in the translations ;-)
8:     For Each CTL In frmHub.Controls
          Select Case TypeName(CTL)
             Case "CommandButton", "OptionButton", "CheckBox", "Label"
9:               If DEBUG_MODE Then
10:                  CTL.Caption = ""
11:              End If
12:              CTL.ToolTipText = ""
             Case "ListView"
13:              If DEBUG_MODE Then
14:                  For i = 1 To CTL.ColumnHeaders.count
15:                       CTL.ColumnHeaders(i).Text = ""
16:                  Next
17:              End If
             Case "TabStrip"
18:              If DEBUG_MODE Then
19:                  For i = 1 To CTL.Tabs.count
20:                       If Not CTL.Name = "tbsScripts" Then CTL.Tabs(i).Caption = ""
21:                  Next
22:              End If
             Case "ToolBar"
23:              For i = 1 To CTL.Buttons.count
24:                   CTL.Buttons.Item(i).ToolTipText = ""
25:              Next
             Case "TextBox"
26:              CTL.ToolTipText = ""
27:        End Select
28:    Next

       'Adds the caption of the objects that with are not translated...
31:    With frmHub
32:        .cmdSkin(0).Caption = "<"
33:        .cmdSkin(1).Caption = ">"
34:        .LabelsURL(0).Caption = "E-mail"
35:        .LabelsURL(1).Caption = "Home Page"
36:        .lblStatus(0).Caption = "1    2    3    4    5    6"
37:        .lblStatus(1).Caption = "------------- Send Chat -------------"
38:        .lblStatus(2).Caption = "1 = Send Chat To All"
39:        .lblStatus(3).Caption = "2 = Send Chat To Op"
40:        .lblStatus(4).Caption = "3 = Send Chat To UnRegistered"
41:        .lblStatus(5).Caption = "4 = Send PM To All"
42:        .lblStatus(6).Caption = "5 = Send PM To Op"
43:        .lblStatus(7).Caption = "6 = Send PM To UnRegistered"
44:        .LblShadowed(0).Caption = "PT Direct Connect Hub"
45:        .LblShadowed(1).Caption = "PT Direct Connect Hub"
46:        .LblShadowed(2).Caption = "Produced bY fLaSh"
47:        .LblShadowed(3).Caption = "Produced bY fLaSh"
48:        .LblShadowed(4).Caption = "Direct Connect P2P Network"
49:        .LblShadowed(5).Caption = "Direct Connect P2P Network"
50:        .lblHolder(30).Caption = "DNS 1"
51:        .lblHolder(34).Caption = "DNS 2"
52:        .lblHolder(35).Caption = "DNS 3"
53:        .lblHolder(36).Caption = "DNS 4"
54:        .lblHolder(38).Caption = "DNS 1"
55:        .lblHolder(39).Caption = "DNS 2"
56:        .lblHolder(41).Caption = "DNS 3"
57:        .lblHolder(42).Caption = "DNS 4"
58:        .lblHolder(55).Caption = "0"
59:        .lblHolder(56).Caption = "0"
60:        .lblHolder(57).Caption = "0 Bytes"
61:        .lblHolder(58).Caption = "0"
62:        .lblHolder(59).Caption = "0"
63:        .lblHolder(60).Caption = "0 Bytes"
64:        .lvwUsers.ColumnHeaders(2).Text = "IP"
65:        .lvwBans.ColumnHeaders(1).Text = "IP"
66:        .lvwPermIPBan.ColumnHeaders(1).Text = "IP"
67:        .lvwTempIPBan.ColumnHeaders(1).Text = "IP"
68:        .lvwTempIPBan.ColumnHeaders(2).Text = "Expire"
69:        .lblStatistics(0).Caption = "0"
70:        .lblStatistics(1).Caption = "0"
71:        .lblStatistics(2).Caption = "0"
72:        .lblStatistics(3).Caption = "0"
73:        .lblStatistics(4).Caption = "0"
74:        .lblStatistics(5).Caption = "0"
75:        .lblStatistics(6).Caption = "0"
76:        .lblStatistics(7).Caption = "0"
77:        .lblStatistics(8).Caption = "0"
78:        .lblStatistics(9).Caption = "0"
79:        .lblStatistics(10).Caption = "NickList:"
80:        .lblStatistics(11).Caption = "ConnectMe:"
81:        .lblStatistics(12).Caption = "RevConnectMe:"
82:        .lblStatistics(13).Caption = "Kicks:"
83:        .lblStatistics(14).Caption = "Redirects:"
84:        .lblStatistics(15).Caption = "BotINFO:"
85:        .lblStatistics(16).Caption = "NetINFO:"
86:        .lblStatistics(17).Caption = "Failed Sockets:"
87:        .lblStatistics(18).Caption = "Aborted Sockets:"
88:        .lblStatistics(19).Caption = "Requests:"
89:        .lblStatistics(20).Caption = "0 Bytes"
90:        .lblStatistics(21).Caption = "0 Bytes"
91:        .lblStatistics(22).Caption = "0 Bytes"
92:        .lblStatistics(23).Caption = "0 Bytes"
93:        .lblStatistics(24).Caption = "0 Bytes"
94:        .lblStatistics(25).Caption = "0 Bytes"
95:        .lblStatistics(26).Caption = "0 Kb/s"
96:        .lblStatistics(27).Caption = "0 Kb/s"
97:        .lblStatistics(28).Caption = "Main Chat messages:"
98:        .lblStatistics(29).Caption = "Private messages:"
99:        .lblStatistics(30).Caption = "A/P Searchs:"
100:       .lblStatistics(31).Caption = "MyINFOs:"
101:       .lblStatistics(32).Caption = "Total Sent:"
102:       .lblStatistics(33).Caption = "Total Received:"
103:       .lblStatistics(34).Caption = "Speed Sent:"
104:       .lblStatistics(35).Caption = "Speed Received:"
105:       .lblQueryDB(0).Caption = "Run"
106:       .lblQueryDB(1).Caption = "Cls"
107:       .cmdPlugins(5).Caption = ">>"
108:       .lblCheck(61).Caption = "SSL"
        #If SVN Then
109:       .tbsMenu.Tabs(10).Caption = "SVN Debug"
110:       .lblSVN(0).Caption = "Log incoming [<--]"
111:       .lblSVN(1).Caption = "Log outgoing [-->]"
112:       .lblSVN(2).Caption = "Log to file"
113:       .lblSVN(3).Caption = "Reserve for SVN Build please no need to translate"
114:       .lblSVN(4).Caption = "Others"
115:       .cmdSVN.Caption = "Clear Log"
        #End If
117:    End With
  
119:    Exit Sub
120:
Err:
121:    HandleError Err.Number, Err.Description, Erl & "|mTranslate.ClearTranslations()"
End Sub
